//
//  DDCompleteAuthController.m
//  LYJR_XDD
//
//  Created by 肖棟棟 on 16/8/8.
//  Copyright © 2016年 肖棟棟. All rights reserved.
//

#import "DDCompleteAuthController.h"

@interface DDCompleteAuthController ()

//恭喜注册成功的label
@property (nonatomic, strong) UILabel *registerSuccessLabel;
//请进行身份认证label
@property (nonatomic, strong) UILabel *identityAuthLabel;

//第一块视图放上传的Label和图片
@property (nonatomic, strong) UIView *firstView;
//点击上传身份证正面
@property (nonatomic, strong) UILabel *uploadIDFrontLabel;
//正面的imageView
@property (nonatomic, strong) UIImageView *frontImgView;

//第二块view
@property (nonatomic, strong) UIView *secondView;
//反面的imageView
@property (nonatomic, strong) UIImageView *backImgView;
//上传身份证背面label
@property (nonatomic, strong) UILabel *uploadIDBackLabel;
//领取美元
@property (nonatomic, strong) UIButton *getDollarBtn;
//暂不认证的label
@property (nonatomic, strong) UILabel *notAuthLabel;

@end

@implementation DDCompleteAuthController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = DDBgColor;
    self.title = @"完成认证";
    [self createUI];
    [self setNavButton];
}



#pragma mark - 私有方法

-(void)setNavButton{
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Group 51"] style:UIBarButtonItemStylePlain target:self action:@selector(backBtnDidClick)];
}

-(void)backBtnDidClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)createUI{


    //添加控件
    [self.view addSubview:self.registerSuccessLabel];
    [self.view addSubview:self.identityAuthLabel];
    
    [self.view addSubview:self.firstView];
    [self.firstView addSubview:self.uploadIDFrontLabel];
    [self.firstView addSubview:self.frontImgView];
    
    [self.view addSubview:self.secondView];
    [self.secondView addSubview:self.uploadIDBackLabel];
    [self.secondView addSubview:self.backImgView];
    
    [self.view addSubview:self.getDollarBtn];
    [self.view addSubview:self.notAuthLabel];
    
    //约束
    [_registerSuccessLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(25.0+64.0);
        make.centerX.equalTo(self.view);
    }];
    
    [_identityAuthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_registerSuccessLabel);
        make.top.equalTo(_registerSuccessLabel.mas_bottom).offset(6.0);
    }];

    [_firstView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_identityAuthLabel.mas_bottom).offset(15.0);
        make.left.equalTo(self.view).offset(15.0);
        make.right.equalTo(self.view).offset(-15.0);
        //高度
        make.height.mas_equalTo(200);
    }];
    
    [_uploadIDFrontLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_firstView).offset(93/2.0);
        make.top.equalTo(_firstView).offset(175/2.0);
    }];
    
    [_frontImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_firstView).offset(484/2.0);
        make.top.equalTo(_firstView).offset(96/2.0);
        make.right.equalTo(_firstView).offset(62/2.0);
        make.bottom.equalTo(_firstView).offset(-96/2.0);
    }];
    
    [_secondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.equalTo(_firstView);
        make.top.equalTo(_firstView.mas_bottom).offset(15.0);
    }];
    
    [_uploadIDBackLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_secondView).offset(175/2.0);
        make.right.equalTo(_secondView).offset(-120/2.0);
    }];
    
    [_backImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_secondView).offset(35.0);
        make.top.equalTo(_secondView).offset(55/2.0);
        make.right.equalTo(_secondView).offset(-500/2.0);
        make.bottom.equalTo(_secondView).offset(-214/2.0);
    }];
    
    [_getDollarBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_secondView.mas_bottom).offset(15.0);
        make.left.right.equalTo(_secondView);

        make.height.mas_equalTo(50);
    }];
    
    [_notAuthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        //防止蹦 加一个顶部的间距
        //make.top.equalTo(_getDollarBtn.mas_bottom).offset(25.0);
        make.centerX.equalTo(self.view);
        make.bottom.equalTo(self.view).offset(-30/2.0);
    }];
}

-(void)getDollarBtnDidClick{
    
    NSLog(@"获取150美元");
}

#pragma mark - setter 和 getter 方法

-(UILabel *)registerSuccessLabel{
    if (_registerSuccessLabel == nil) {
        _registerSuccessLabel =[[UILabel alloc]init];
        _registerSuccessLabel.text = @"恭喜注册成功!";
        _registerSuccessLabel.font =[UIFont systemFontOfSize:18.0];
        _registerSuccessLabel.textColor =[UIColor colorWithHexColor:@"#FFFFFF"];
        //居中
        _registerSuccessLabel.textAlignment = NSTextAlignmentCenter;
        [_registerSuccessLabel sizeToFit];
    }
    return _registerSuccessLabel;
}

-(UILabel *)identityAuthLabel{
    if (_identityAuthLabel == nil) {
        _identityAuthLabel =[[UILabel alloc]init];
        _identityAuthLabel.text =@"请进行身份认证,成功即送150美元";
        _identityAuthLabel.font =[UIFont systemFontOfSize:12.0];
        _identityAuthLabel.textColor =[UIColor colorWithHexColor:@"#A7ABB4"];
        //居中
        _identityAuthLabel.textAlignment = NSTextAlignmentCenter;
        [_identityAuthLabel sizeToFit];
    }
    return _identityAuthLabel;
}

-(UIView *)firstView{
    if (_firstView == nil) {
        _firstView = [[UIView alloc] init];
        _firstView.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"shen fen zheng kuang"]];
        
    }
    return _firstView;
}

//点击Label要访问照相机或者相册上传身份证
-(UILabel *)uploadIDFrontLabel{
    if (_uploadIDFrontLabel == nil) {
        _uploadIDFrontLabel =[[UILabel alloc]init];
        _uploadIDFrontLabel.text =@"点击上传身份证正面";
        _uploadIDFrontLabel.font =[UIFont systemFontOfSize:18.0];
        _uploadIDFrontLabel.textColor =[UIColor colorWithHexColor:@"#FFCB6F"];
        //居中
        _uploadIDFrontLabel.textAlignment = NSTextAlignmentCenter;
        [_uploadIDFrontLabel sizeToFit];
    }
    return _uploadIDFrontLabel;
}


-(UIImageView *)frontImgView{
    if (_frontImgView == nil) {
        _frontImgView =[[UIImageView alloc]init];
        _frontImgView.image =[UIImage imageNamed:@"Group 12"];
    }
    return _frontImgView;
}

-(UIView *)secondView{
    if (_secondView == nil) {
        _secondView = [[UIView alloc] init];
        //设置圆角
        _secondView.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"shen fen zheng kuang"]];
        
    }
    return _secondView;
}

-(UILabel *)uploadIDBackLabel{
    if (_uploadIDBackLabel == nil) {
        _uploadIDBackLabel =[[UILabel alloc]init];
        _uploadIDBackLabel.text =@"点击上传身份证背面";
        _uploadIDBackLabel.font =[UIFont systemFontOfSize:18.0];
        _uploadIDBackLabel.textColor =[UIColor colorWithHexColor:@"#FFCB6F"];
        //居中
        _uploadIDBackLabel.textAlignment = NSTextAlignmentCenter;
        [_uploadIDBackLabel sizeToFit];
    }
    return _uploadIDBackLabel;
}

-(UIImageView *)backImgView{
    if (_backImgView == nil) {
        _backImgView =[[UIImageView alloc]init];
        _backImgView.image =[UIImage imageNamed:@"Group 2"];
    }
    return _backImgView;
}

-(UIButton *)getDollarBtn{
    if (_getDollarBtn == nil) {
        _getDollarBtn = [[UIButton alloc] init];
        [_getDollarBtn setTitle:@"领取150美元" forState:UIControlStateNormal];
        _getDollarBtn.titleLabel.font=[UIFont systemFontOfSize:18];
        [_getDollarBtn setTitleColor:[UIColor colorWithHexColor:@"#FFCB6F"] forState:UIControlStateNormal];
        [_getDollarBtn setBackgroundImage:[UIImage imageNamed:@"bu ke dian zhuangtai"] forState:UIControlStateNormal];
        [_getDollarBtn addTarget:self action:@selector(getDollarBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _getDollarBtn;
}
-(UILabel *)notAuthLabel{
    if (_notAuthLabel == nil) {
        _notAuthLabel =[[UILabel alloc]init];
        _notAuthLabel.text =@"暂不认证";
        _notAuthLabel.font =[UIFont systemFontOfSize:12.0];
        _notAuthLabel.textColor =[UIColor colorWithHexColor:@"#66666B"];
        //居中
        _notAuthLabel.textAlignment = NSTextAlignmentCenter;
        [_notAuthLabel sizeToFit];
    }
    return _notAuthLabel;
}


@end
